﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Payroll.Biz.Legacy.Models
{
    public class MailMethod : IPaymentMethod
    {
        public string MailAddress { get; private set; }

        public MailMethod(string mailAddress) { MailAddress = mailAddress; }

        public void Pay(Paycheck paycheck) { paycheck.Disposition = DispositionType.MAIL; }

        public override string ToString() { return $"{{{nameof(MailAddress)}={MailAddress}}}"; }

        public override bool Equals(object obj)
        { return (obj is MailMethod method) && (MailAddress == method.MailAddress); }

        public override int GetHashCode()
        { return 826360918 + EqualityComparer<string>.Default.GetHashCode(MailAddress); }
    }
}
